| Conditions | 2 |
| Total Lines | 22 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Inject } from '@nestjs/common'; |
||
| 17 | |||
| 18 | public async execute(command: CreateShootingCommand): Promise<string> { |
||
| 19 | const { name, groupClosingDate, individualClosingDate, schoolId, shootingDate, notice } = command; |
||
| 20 | |||
| 21 | const school = await this.schoolRepository.findOneById(schoolId); |
||
| 22 | if (!school) { |
||
| 23 | throw new SchoolNotFoundException(); |
||
| 24 | } |
||
| 25 | |||
| 26 | const shooting = await this.shootingRepository.save( |
||
| 27 | new Shooting( |
||
| 28 | name, |
||
| 29 | shootingDate, |
||
| 30 | groupClosingDate, |
||
| 31 | individualClosingDate, |
||
| 32 | ShootingStatus.DISABLED, |
||
| 33 | school, |
||
| 34 | notice |
||
| 35 | ) |
||
| 36 | ); |
||
| 37 | |||
| 38 | return shooting.getId(); |
||
| 39 | } |
||
| 41 |